import type { RouteRecordRaw } from 'vue-router';
/**
 * 静态路由（默认路由）
 */
 export const staticRoutes: Array<RouteRecordRaw> = [
   //登录的路由
   {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
    meta: {
      hidden: true
    }
  },
  //404路由
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/error/404.vue'),
    meta: {
      hidden: true
    }
  },
  //home首页
  {
    path: '/',
    component: () => import('@/layout/index.vue'),
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'Home',
      component: () => import('@/views/home/index.vue'),
      meta: {
        title: '首页',
        icon: 'ele-HomeFilled',
      }
    }]
  }
];


/**
 * 定义动态路由
 */
 //异步路由：动态路由,将来动态给路由器注册的路由[根据不同用户区别对待]
 export const allAsyncRoutes = [
   //权限管理
   {
     name: 'Acl',
     path: '/acl',
     component: () => import('@/layout/index.vue'),
     redirect: '/acl/user/list',
     meta: { title: '权限管理', icon: 'ele-Setting' },
     children: [
       {
         name: 'User',
         path: '/acl/user/list',
         component: () => import('@/views/acl/user/index.vue'),
         meta: { title: '用户管理' }
       },
       {
         name: 'Role',
         path: '/acl/role/list',
         component: () => import('@/views/acl/role/index.vue'),
         meta: {
           title: '角色管理',
         },
       },
       {
         name: 'RoleAuth',
         path: '/acl/role/auth',
         component: () => import('@/views/acl/role/roleAuth.vue'),
         meta: {
           title: '角色管理',
           hidden: true,
           activeMenu: '/acl/role/list',
         },
       },
       {
         name: 'Permission',
         path: '/acl/permission/list',
         component: () => import('@/views/acl/permission/index.vue'),
         meta: {
           title: '菜单管理',
         }
       }
     ]
   },
   //商品管理
   {
     name: 'Product',
     path: '/product',
     component: () => import('@/layout/index.vue'),
     meta: {
       title: '商品管理',//决定当前一级路由左侧菜单名字
       icon: 'ele-GoodsFilled'
     },
     //重定向二级路由
     redirect: '/product/trademark',
     children: [
       {
         name: 'Trademark',
         path: 'trademark',
         component: () => import('@/views/product/trademark/index.vue'),
         meta: {
           title: '品牌管理',//二级路由标题
           icon: 'ele-Eleme'
         }
       },
       {
         path: 'attr',
         name: 'Attr',
         component: () => import('@/views/product/attr/index.vue'),
         meta: {
           title: '平台属性管理',
           icon: 'ele-BrushFilled'
         },
       },
       {
         path: 'spu',
         name: 'Spu',
         component: () => import('@/views/product/spu/index.vue'),
         meta: {
           title: 'SPU管理',
           icon: 'ele-Opportunity'
         }
       },
       {
         path: 'sku',
         name: 'Sku',
         component: () => import('@/views/product/sku/index.vue'),
         meta: {
           title: 'SKU管理',
           icon: 'ele-Headset'
         }
       }
     ]
   }
 ]
 

//任意路由
export const anyRoute =  {
  path: '/:pathMatch(.*)',
  name: 'Any',
  redirect: '/404',
  meta: {
    hidden: true
  }
}
